import { IsNumber, IsString, Length, Max, Min } from 'class-validator'
import { Limits } from '@boticord/consts'
import { IsOptionalString } from '@boticord/common/is-optional-string.decorator'

export class CreateReviewDto {
  @IsString()
  @IsOptionalString()
  @Length(Limits.MinCommentLength, Limits.MaxCommentLength)
  declare content?: string

  @IsNumber({
    allowNaN: false,
    allowInfinity: false,
    maxDecimalPlaces: 0,
  })
  @Min(Limits.MinRating)
  @Max(Limits.MaxRating)
  declare rating: number
}